package com.example.secudemo.secu;

import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.stereotype.Component;


@Component
public class SecurityConfiguer extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.formLogin().loginPage("/login.html")
                .loginProcessingUrl("/login")
                .successForwardUrl("/loginsuccess.html");
        http.authorizeRequests().antMatchers("/login.html").permitAll()
                ;
        http.authorizeRequests().anyRequest().authenticated();
        http.authorizeRequests().and().csrf().disable();
    }
}
